//鼠标移上去，显示放大效果
$("#box #shade").hover(function(){
	$('#box #move').show();
	$('#box #bimg').show();
},function(){
	$('#box #move').hide();
	$('#box #bimg').hide();
})

$('#box #shade').mousemove(function(e){
	var $x = e.pageX;
	var $y = e.pageY;
	//console.log($y)
	var $l = $('#box').offset().left;
	var $t = $('#box').offset().top;
	//console.log($t)
	var $w = $('#box #move').width()/2;
	var $h = $('#box #move').height()/2;
	//console.log($h)
	var $left = $x - $l -$w;//透明小区块左面的距离
	
	var $top = $y - $t - $h;//透明小区块右面的距离
	//console.log($left)
	//console.log($top)
	if($top<0){
		$top = 0;
	}else if($top>($('#box #shade').height() - $h*2)){
		$top = $('#box #shade').height() - $h*2;
		
	}
	if($left<0){
		$left = 0;
	}else if($left>($('#box #shade').width()-$w*2)){
		$left = $('#box #shade').width() - $w*2;		
	}
	$('#box #move').css({left:$left,top:$top});
	//放大两倍
	$("#box #bimg img").css({left:-$left*2,top:-$top*2});

})
